<?php
	/**
	 * This is a quick-and-dirty draft QPanel object to do Create, Edit, and Delete functionality
	 * of the TableUserProject class.  It uses the code-generated
	 * TableUserProjectMetaControl class, which has meta-methods to help with
	 * easily creating/defining controls to modify the fields of a TableUserProject columns.
	 *
	 * Any display customizations and presentation-tier logic can be implemented
	 * here by overriding existing or implementing new methods, properties and variables.
	 * 
	 * NOTE: This file is overwritten on any code regenerations.  If you want to make
	 * permanent changes, it is STRONGLY RECOMMENDED to move both table_user_project_edit.php AND
	 * table_user_project_edit.tpl.php out of this Form Drafts directory.
	 *
	 * @package My Application
	 * @subpackage Drafts
	 */
	class TableUserProjectEditPanel extends QPanel {
		// Local instance of the TableUserProjectMetaControl
		protected $mctTableUserProject;

		// Controls for TableUserProject's Data Fields
		public $lblId;
		public $txtCategoryId;
		public $txtSubcategoryId;
		public $txtUserName;
		public $txtPassword;
		public $txtFirstname;
		public $txtLastname;
		public $txtCompanyname;
		public $txtMail;
		public $txtMail2;
		public $txtIp;
		public $txtCountry;
		public $txtCity;
		public $txtAddress1;
		public $txtAddress2;
		public $txtPostalCode;
		public $txtPhone;
		public $txtFax;
		public $calLoginDate;
		public $calLogoutDate;
		public $calTimeupDate;
		public $txtUserType;
		public $txtUserLevel;
		public $txtBoothCount;
		public $txtPortfolioCount;
		public $txtPointBalance;
		public $txtPointInTotal;
		public $txtPointOutTotal;
		public $txtPointChargedTotal;
		public $txtLanguageId;
		public $txtSendmailNews;
		public $txtSendmailByKeywordInNewProject;
		public $txtSendmailByNewBid;
		public $txtKeyword;
		public $txtRateAsBuyer;
		public $txtRateAsProvider;
		public $txtRateAsBuyer6month;
		public $txtRateAsProvider6month;
		public $txtAuthorized;
		public $txtAuthorizationCode;
		public $calAuthorizedDate;
		public $txtActive;
		public $txtSuspended;
		public $txtAffiliatorId;
		public $txtAffliatorCode;
		public $txtFirstnameKana;
		public $txtLastnameKana;
		public $txtDepartment;

		// Other ListBoxes (if applicable) via Unique ReverseReferences and ManyToMany References

		// Other Controls
		public $btnSave;
		public $btnDelete;
		public $btnCancel;

		// Callback
		protected $strClosePanelMethod;

		public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null) {
			// Call the Parent
			try {
				parent::__construct($objParentObject, $strControlId);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Setup Callback and Template
			$this->strTemplate = 'TableUserProjectEditPanel.tpl.php';
			$this->strClosePanelMethod = $strClosePanelMethod;

			// Construct the TableUserProjectMetaControl
			// MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
			$this->mctTableUserProject = TableUserProjectMetaControl::Create($this, $intId);

			// Call MetaControl's methods to create qcontrols based on TableUserProject's data fields
			$this->lblId = $this->mctTableUserProject->lblId_Create();
			$this->txtCategoryId = $this->mctTableUserProject->txtCategoryId_Create();
			$this->txtSubcategoryId = $this->mctTableUserProject->txtSubcategoryId_Create();
			$this->txtUserName = $this->mctTableUserProject->txtUserName_Create();
			$this->txtPassword = $this->mctTableUserProject->txtPassword_Create();
			$this->txtFirstname = $this->mctTableUserProject->txtFirstname_Create();
			$this->txtLastname = $this->mctTableUserProject->txtLastname_Create();
			$this->txtCompanyname = $this->mctTableUserProject->txtCompanyname_Create();
			$this->txtMail = $this->mctTableUserProject->txtMail_Create();
			$this->txtMail2 = $this->mctTableUserProject->txtMail2_Create();
			$this->txtIp = $this->mctTableUserProject->txtIp_Create();
			$this->txtCountry = $this->mctTableUserProject->txtCountry_Create();
			$this->txtCity = $this->mctTableUserProject->txtCity_Create();
			$this->txtAddress1 = $this->mctTableUserProject->txtAddress1_Create();
			$this->txtAddress2 = $this->mctTableUserProject->txtAddress2_Create();
			$this->txtPostalCode = $this->mctTableUserProject->txtPostalCode_Create();
			$this->txtPhone = $this->mctTableUserProject->txtPhone_Create();
			$this->txtFax = $this->mctTableUserProject->txtFax_Create();
			$this->calLoginDate = $this->mctTableUserProject->calLoginDate_Create();
			$this->calLogoutDate = $this->mctTableUserProject->calLogoutDate_Create();
			$this->calTimeupDate = $this->mctTableUserProject->calTimeupDate_Create();
			$this->txtUserType = $this->mctTableUserProject->txtUserType_Create();
			$this->txtUserLevel = $this->mctTableUserProject->txtUserLevel_Create();
			$this->txtBoothCount = $this->mctTableUserProject->txtBoothCount_Create();
			$this->txtPortfolioCount = $this->mctTableUserProject->txtPortfolioCount_Create();
			$this->txtPointBalance = $this->mctTableUserProject->txtPointBalance_Create();
			$this->txtPointInTotal = $this->mctTableUserProject->txtPointInTotal_Create();
			$this->txtPointOutTotal = $this->mctTableUserProject->txtPointOutTotal_Create();
			$this->txtPointChargedTotal = $this->mctTableUserProject->txtPointChargedTotal_Create();
			$this->txtLanguageId = $this->mctTableUserProject->txtLanguageId_Create();
			$this->txtSendmailNews = $this->mctTableUserProject->txtSendmailNews_Create();
			$this->txtSendmailByKeywordInNewProject = $this->mctTableUserProject->txtSendmailByKeywordInNewProject_Create();
			$this->txtSendmailByNewBid = $this->mctTableUserProject->txtSendmailByNewBid_Create();
			$this->txtKeyword = $this->mctTableUserProject->txtKeyword_Create();
			$this->txtRateAsBuyer = $this->mctTableUserProject->txtRateAsBuyer_Create();
			$this->txtRateAsProvider = $this->mctTableUserProject->txtRateAsProvider_Create();
			$this->txtRateAsBuyer6month = $this->mctTableUserProject->txtRateAsBuyer6month_Create();
			$this->txtRateAsProvider6month = $this->mctTableUserProject->txtRateAsProvider6month_Create();
			$this->txtAuthorized = $this->mctTableUserProject->txtAuthorized_Create();
			$this->txtAuthorizationCode = $this->mctTableUserProject->txtAuthorizationCode_Create();
			$this->calAuthorizedDate = $this->mctTableUserProject->calAuthorizedDate_Create();
			$this->txtActive = $this->mctTableUserProject->txtActive_Create();
			$this->txtSuspended = $this->mctTableUserProject->txtSuspended_Create();
			$this->txtAffiliatorId = $this->mctTableUserProject->txtAffiliatorId_Create();
			$this->txtAffliatorCode = $this->mctTableUserProject->txtAffliatorCode_Create();
			$this->txtFirstnameKana = $this->mctTableUserProject->txtFirstnameKana_Create();
			$this->txtLastnameKana = $this->mctTableUserProject->txtLastnameKana_Create();
			$this->txtDepartment = $this->mctTableUserProject->txtDepartment_Create();

			// Create Buttons and Actions on this Form
			$this->btnSave = new QButton($this);
			$this->btnSave->Text = QApplication::Translate('Save');
			$this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
			$this->btnSave->CausesValidation = $this;

			$this->btnCancel = new QButton($this);
			$this->btnCancel->Text = QApplication::Translate('Cancel');
			$this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));

			$this->btnDelete = new QButton($this);
			$this->btnDelete->Text = QApplication::Translate('Delete');
			$this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('TableUserProject') . '?'));
			$this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
			$this->btnDelete->Visible = $this->mctTableUserProject->EditMode;
		}

		// Control AjaxAction Event Handlers
		public function btnSave_Click($strFormId, $strControlId, $strParameter) {
			// Delegate "Save" processing to the TableUserProjectMetaControl
			$this->mctTableUserProject->SaveTableUserProject();
			$this->CloseSelf(true);
		}

		public function btnDelete_Click($strFormId, $strControlId, $strParameter) {
			// Delegate "Delete" processing to the TableUserProjectMetaControl
			$this->mctTableUserProject->DeleteTableUserProject();
			$this->CloseSelf(true);
		}

		public function btnCancel_Click($strFormId, $strControlId, $strParameter) {
			$this->CloseSelf(false);
		}

		// Close Myself and Call ClosePanelMethod Callback
		protected function CloseSelf($blnChangesMade) {
			$strMethod = $this->strClosePanelMethod;
			$this->objForm->$strMethod($blnChangesMade);
		}
	}
?>